/*
ID:luongho3
LANG:C++
TASK:fence
*/
#include <iostream>
#include <fstream>
#include <queue>
using namespace std;
ifstream fin("fence.in");
ofstream fout("fence.out");
#define NINTER 501

typedef queue<int> iqueue;
int ninter, nfence;
int deg[NINTER], hasedge[NINTER][NINTER], hasinter[NINTER]; 

void init() {
     int i,j;
     for (i=1;i<=ninter;++i) {
         hasinter[i] = 0;
         for (j=i;j<=ninter;++j) {
             hasedge[i][j] = hasedge[j][i] = 0;
         }
     }
}
void load_graph() {
     fin >> nfence;
     int i,u,v;
     ninter = NINTER;
     for (i=1;i<=nfence;++i) {
         fin >> u >> v;
         if (hasinter[u] == 0) {
            hasinter[u] = 1;
            deg[u] = 1;
         }
         else {
              deg[u]++;
         }
         if (hasinter[v] == 0) {
            hasinter[v] = 1;
            deg[v] = 1;
         }
         else {
              deg[v]++;
         }
         hasedge[u][v]++;
         hasedge[v][u]++;
     }    
}
bool can_go_back(int from, int to) {
     iqueue qu;
     int top, isfree[NINTER];
     int i,j;
     for (i=1;i<=ninter;++i) {
         isfree[i] = 1;
     }
     qu.push(from);
     isfree[from] = 0;
     hasedge[from][to]--;
     hasedge[to][from]--;
     while (!qu.empty()) {
           top = qu.front();
           qu.pop();
           for (i=1;i<=ninter;++i) {
               if (hasedge[top][i]>0 && isfree[i]==1) {
                  qu.push(i);
                  isfree[i] = 0;
                  if (isfree[to]==0) {
                     hasedge[from][to]++;
                     hasedge[to][from]++;
                     return true;
                  }
               }
           }
     }
     hasedge[from][to]++;
     hasedge[to][from]++;
     return false;
}
int main() {
    init();
    load_graph();
    int current, src, next;
    int i,j;
    src = current = 1;
    for (i=1;i<=ninter;++i) {
        if (hasinter[i]==1 && deg[i] % 2 == 1) {
           src = current = i;
           break;
        }
    }
    fout << current << "\n";
    do {
        next = 0;
        for (i=1;i<=ninter;++i) {
            if (hasedge[current][i]>0) {
                next = i;
                if (can_go_back(current,next) == true) {
                   break;
                }
            }
        }
        if (next!=0) {
           hasedge[next][current]--;
           hasedge[current][next]--;
           deg[next]--;
           deg[current]--;
           fout << next << "\n";
           current = next;
        }        
    } while(next!=0);
    return 0;
}
